// ============================================================================
//
// Copyright (C) 2006-2007 Dengues
//
// Google Group: http://groups.google.com/group/dengues
// QQ Group: 24885404
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ============================================================================
package org.dengues.ui.prefs;

import org.dengues.core.prefs.IDenguesPrefsConstant;
import org.dengues.core.resource.DenguesProjectFactory;
import org.dengues.ui.DenguesUiPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;

/**
 * Qiang.Zhang.Adolf@gmail.com class global comment. Detailled comment <br/>
 * 
 * $Id: Dengues.epf 2007-11-23 qiang.zhang $
 * 
 */
public class DenguesPreferenceInitializer extends AbstractPreferenceInitializer {

    /**
     * Qiang.Zhang.Adolf@gmail.com DenguesPreferenceInitializer constructor comment.
     */
    public DenguesPreferenceInitializer() {
    }

    @Override
    public void initializeDefaultPreferences() {
        IPreferenceStore store = DenguesUiPlugin.getDefault().getPreferenceStore();
        store.setDefault(IDenguesPrefsConstant.HSQLDB_START, false);

        store.setDefault(IDenguesPrefsConstant.SQL_ALTERNATE_DELIMITER, "--"); //$NON-NLS-1$
        store.setDefault(IDenguesPrefsConstant.SQL_COMMENT_DELIMITER, ";"); //$NON-NLS-1$
        store.setDefault(IDenguesPrefsConstant.SQL_QUERY_DELIMITER, ";"); //$NON-NLS-1$

        // store.setDefault(IDenguesPrefsConstant.PALETTE_STATE, FlyoutPaletteComposite.STATE_PINNED_OPEN);
        // store.setDefault(IDenguesPrefsConstant.PALETTE_DOCK_LOCATION, PositionConstants.WEST);
        // store.setDefault(IDenguesPrefsConstant.PALETTE_SIZE, 100);

        store.setDefault(IDenguesPrefsConstant.SOCKET_TIME_SPACING, 500);
        store.setDefault(IDenguesPrefsConstant.SOCKET_PORT, 56565);
        store.setDefault(IDenguesPrefsConstant.SOCKET_ENABLED, true);

        store.setDefault(IDenguesPrefsConstant.REFRESH_JET_TEMP, false);
        store.setDefault(IDenguesPrefsConstant.REFRESH_JET_ALREADY, false);

        store.setDefault(IDenguesPrefsConstant.CONNECTION_AUTO_TEST, false);
        store.setDefault(IDenguesPrefsConstant.CONNECTION_SCHEDULE_ENABLED, false);
        store.setDefault(IDenguesPrefsConstant.CONNECTION_SCHEDULE_MILISECONDS, new Long(10 * 60000));

        store.setDefault(IDenguesPrefsConstant.SERVER_DIRECTORY, new Path(Platform.getInstallLocation().getURL().getPath())
                .toOSString());

        store.setDefault(IDenguesPrefsConstant.SYSTEM_LOG_DIRECTORY, DenguesProjectFactory.getDenguesProject().getProject()
                .getLocation().toPortableString()
                + "/log");
        store.setDefault(IDenguesPrefsConstant.SYSTEM_LOG_FILENAME, ".log");

        store.setDefault(IDenguesPrefsConstant.DESIGNER_COLOR_BLOCK, "165,221,248"); //$NON-NLS-1$

        store.setDefault(IDenguesPrefsConstant.DESIGNER_COLOR_COMPONENT, "255,255,0"); //$NON-NLS-1$

        store.setDefault(IDenguesPrefsConstant.DESIGNER_COLOR_MODIFIED, "128,64,0"); //$NON-NLS-1$

        store.setDefault(IDenguesPrefsConstant.DESIGNER_EDITOR_GRID, 16);
        store.setDefault(IDenguesPrefsConstant.DESIGNER_COMPONENT_HEIGHT, 3);
        store.setDefault(IDenguesPrefsConstant.DESIGNER_COMPONENT_WITH, 8);
        Font font = new Font(null, PreferenceConverter.FONTDATA_DEFAULT_DEFAULT.getName(), 11, SWT.BOLD);
        PreferenceConverter.setDefault(store, IDenguesPrefsConstant.DESIGNER_COLOR_FONT, font.getFontData());
        store.setDefault(IDenguesPrefsConstant.DESIGNER_COLOR_OUTLINE, "92,152,163");//$NON-NLS-1$

        store.setDefault(IDenguesPrefsConstant.REFRESH_BLOCKS, false);
    }

}
